<template>
  <div class="history">
    <div class="header">
      <p
        @click="
          () => {
            this.$router.push('/Profile');
          }
        "
      >
         <van-icon name="arrow-left"/>
      </p>
      <p>查看历史</p>
      <p></p>
    </div>
    <div class="main">
      <div class="list-three">
        <dl
          v-for="(item, index) in hisList"
          :key="index"
          @click="btndetail(item)"
        >
          <dt>
            <img :src="'http://47.102.145.189:8009' + item.houseImg" alt="" />
          </dt>
          <dd>
            <p>{{ item.desc }}</p>
            <p>{{ item.title }}</p>
            <p>{{ item.price }}</p>
          </dd>
        </dl>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      hisList: [],
    };
  },
  created() {
    console.log(JSON.parse(sessionStorage.getItem("History")));
    this.hisList=JSON.parse(sessionStorage.getItem("History"))
  },

  methods:{
    btndetail(item){
      // this.$router.push('/Detail')
       this.$router.push({ path: "/Detail", query: { id: item.houseCode } });
    }
  }
};
</script>

<style scoped>
.history {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.header {
  width: 100%;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #e6e6e6;
  padding: 0 10px;
  font-size: 16px;
}
.main {
  flex: 1;
  overflow: scroll;
}
.list-three {
  width: 100%;
  height: 100%;
  background: #fff;
  padding: 0 10px;
}
.list-three dl {
  width: 100%;
  height: 120px;
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #ccc;
}
.list-three dl dt {
  width: 30%;
  height: 95%;
}
.list-three dl dt img {
  width: 100%;
  height: 100%;
}
.list-three dl dd {
  font-size: 14px;
  padding: 0 10px;
}
</style>